<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page isELIgnored="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@ include file="/common/common-jsp.jspf" %>
<title>员工列表</title>
<link rel="stylesheet" type="text/css" href="${proPath }/css/common.css">
<script type="text/javascript" src="${proPath }/js/page.js"></script>
<script type="text/javascript">
$(function() {
	$('.delete').click(function() {
		var deleteUrl=$(this).attr('href');
		console.log(deleteUrl);
		$('#delete').attr('action', deleteUrl).submit();
		return false;
	});
});
</script>
</head>
<body>
	<form id="delete" action="" method="POST">
		<input type="hidden" name="_method" value="DELETE"/>
	</form>
	<div class="container">
		<c:if test="${empty employees }">
			没有任何员工信息
		</c:if>
		<c:if test="${!empty employees }">
		<table border="1" >
			<tr>
				<td>姓名</td>
				<td>性别</td>
				<td>生日</td>
				<td>部门</td>
				<td>编辑</td>
				<td>删除</td>
			</tr>
			<c:forEach items="${employees }" var="emp">
			<tr>
				<td>${emp.name }</td>
				<td>${emp.gender == 1 ? "男" : "女" }</td>
				<td><fmt:formatDate value="${emp.birthday }" pattern="yyyy-MM-dd"/></td>
				<td>${emp.department.name }</td>
				<td><a href="${proPath }/employee/employee/${emp.id}">编辑</a></td>
				<td><a class="delete" href="${proPath }/employee/employee/${emp.id}">删除</a></td>
			</tr>
			</c:forEach>
		</table>
		</c:if>
		<a href="${proPath }/employee/employee">增加员工</a>
	</div>

</body>
</html>
